#!/usr/bin/perl
#
#
while($line=<STDIN>) {
	if($line=~/^[0-9]+$/) {
		$sen="";
	}
	elsif($line=~/^\s*$/) {
		$sen=~s/ $//g;
		print "$sen\n";
	}
	else {
		$line=~s/\s.*$//g;
		($word,$pos,$root) = split(/_+/,$line);
		$sen.=$root." ";
	}
}

$sen=~s/ $//g;
print "$sen\n";
